<?php
/**
 * Template Name: Add Team
 *
 */
//wp_cache_post_change( get_the_ID() );
get_header(); ?>

<div class="container">
    <h1><?php the_title() ?></h1>

    <div class="row-fluid">
        <div class="span9">

            <div class="card grey">
                <form class="form-horizontal" id="TeamForm">
                    <h2 id="team_details_title">Details</h2>
                    <div class="control-group">
                        <label class="control-label" for="team_name">Team Name</label>
                        <div class="controls">
                            <input type="text" id="team_name" name="team_name" placeholder="">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="team_colour">Shirt Colour</label>
                        <div class="controls">
                            <select id="team_colour" name="team_colour">
                                <option selected="selected" value="red">Red</option>
                                <option value="blue">Blue</option>
                                <option value="white">White</option>
                                <option value="black">Black</option>
                                <option value="green">Green</option>
                                <option value="yellow">Yellow</option>
                            </select>
                        </div>
                    </div>
                    <hr>
                    <h2 id="team_name_title">Players</h2>
                    <table class="table table-condensed table-bordered table-striped" id="playersTable">
                        <thead>
                        <tr>
                            <th>Name</th>
                            <th></th>
                            <th>Email</th>
                            <th style="width:80px;"></th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                    <span class="btn btn-primary btn-small add-player" style="font-weight: 800;margin-bottom: 0">Add Player &raquo;</span>
                    <hr>
                    <button type="submit" class="btn btn-primary btn-small" style="font-weight: 800;margin-bottom: 0">Save</button>

                </form>
            </div>
        </div>
    </div>
</div>

<!-- Special Price Modal -->
<div id="specialModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="specialModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="specialModalLabel">Add Special Price</h3>
    </div>
    <div class="modal-body">

        <form id="SpecialForm" class="form-horizontal">
            <input type="hidden" name="form_date" />
            <input type="hidden" name="form_slot" />

            <div class="control-group">
                <label class="control-label">Current Price</label>

                <div class="controls current-price">
                    £55.00
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="Special">Special Price</label>

                <div class="controls">
                    <input id="Special" name="form_special" />
                </div>
            </div>
        </form>
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button id="SpecialFormSubmit" type="submit" data-dismiss="modal" class="btn btn-primary">Set Special Price</button>
    </div>
</div>

<!-- Internal Booking Modal -->
<div id="InternalModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="internalModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="InternalModalLabel">Book this slot internally</h3>
    </div>
    <div class="modal-body">

        <form id="InternalForm" class="form-horizontal">
            <input type="hidden" name="form_date" />
            <input type="hidden" name="form_slot" />
            <input type="hidden" name="form_user" value="<?echo get_user_id(); ?>"/>

            <div class="control-group">
                <label class="control-label" for="Special">Internal Comments</label>

                <div class="controls">
                    <textarea id="Internal" name="form_comments" ></textarea>
                </div>
            </div>
        </form>
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button id="InternalFormSubmit" type="submit" data-dismiss="modal" class="btn btn-primary">Book Internally</button>
    </div>
</div>

<!-- Add Slot Modal -->
<div id="slotModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="slotModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="slotModalLabel">Add New Slot</h3>
    </div>
    <div class="modal-body">

        <form id="SlotForm" class="form-horizontal">
            <input type="hidden" name="new_slot_form" value="true"/>
            <div class="control-group">
                <label class="control-label" for="Price">Price</label>

                <div class="controls">
                    <input id="Price" name="form_price" value="45.00" type="text"/>
                </div>
            </div>
        </form>
    </div>
    <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button id="SlotFormSubmit" type="submit" data-dismiss="modal" class="btn btn-primary">Add Slots</button>
    </div>
</div>


<?php get_footer(); ?>
<script src="<?php echo get_template_directory_uri(); ?>/js/PW.addNewTeam.js"></script>
<script>
    $(function () {
        var options = {
            booking:'<? echo get_permalink($_REQUEST['b']); ?>',
            dir:'<? echo get_template_directory_uri(); ?>'
        };
        PW.addNewTeam.init(options);
    });
</script>